package Task38;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int size = scanner.nextInt();
            String[] strings = new String[size];
            for (int i = 0; i < strings.length;i++) {
                strings[i] = scanner.nextLine();
            }
            int nmax = 0;
            int mmax = 0;
            for (int i = 0; i < strings.length ; i++) {
                if( strings[i].contains("disconnect")){
                    nmax++;
                } else if (strings[i].contains("connect")) {
                    if(nmax <= 0){
                        mmax++;
                    }else {
                        nmax--;
                    }
                }
            }
            System.out.println(mmax);
        }
    }

}
